// pages/auth/index.js
import { request } from "../../request/index.js";
import regeneratorRuntime from "../../lib/runtime/runtime";
import { login } from "../../utils/asyncWx.js";
Page({
  handleFn(e) {
    try {
      console.log(e);
      const { encryptedData, rawData, iv, signature } = e.datail;
      const { code } = login();
      const queryparams = { encryptedData, rawData, iv, signature, code };
      const { token } = request({
        url: "/users/wxlogin",
        data: queryparams,
        method: "POST"
      });
    } catch (err) {
      console.log(err);
    }
    wx.setStorageSync(
      "token",
      "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo"
    );
    wx.navigateBack({
      delta: 1
    });
  }
});
